<?php
/**
 * @description : A factory for read xml file.
 * @class-name  : ConfigReaderFactory. 
 * @method      : getInstance().
 * @method      : getConfigReader().
 * @method      : clone.
 * @author      : stephen.mo@hotmail.com
 * @version     : $Id , 1.0.0
 * @date        : Mar 24,2011
 */

class ConfigReaderFactory {
    static private $instance;
    private $config_readers;

    private function __construct() {
        /** -- construct -- */
    }

    static public function getInstance() {/*{{{*/
        if (!isset(self::$instance)) {
            $c = __CLASS__;
            self::$instance = new $c();
        }
        return self::$instance;
    }/*}}}*/

    /** prevent users to clone the instace */
    public function __clone() {
        trigger_error('Clone is not allowed!',E_USER_ERROR);
    }

    /** read the config contents */
    public function getConfigReader($file_name) {/*{{{*/
        if (!isset($this->config_readers[$file_name])) {
            $this->config_readers[$file_name] = new ConfigReader($file_name);
        }
        return $this->config_readers[$file_name];
    }/*}}}*/


}


?>

